package arm;

import com.sun.xml.internal.ws.org.objectweb.asm.ClassAdapter;
import com.sun.xml.internal.ws.org.objectweb.asm.ClassVisitor;
import com.sun.xml.internal.ws.org.objectweb.asm.MethodVisitor;

/**
 * 描述：TODO
 *
 * @author: zhubb
 * @Date:2020/7/27
 * @Package:com.activiti6.demo
 * @version:1.0
 */
public class AddSecurityCheckClassAdapter  extends ClassAdapter {

    public AddSecurityCheckClassAdapter(ClassVisitor cv) {
        super(cv);
    }

    @Override
    public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
        MethodVisitor methodVisitor = cv.visitMethod(access, name, desc, signature, exceptions);
        if (methodVisitor != null) {
            if (name.equalsIgnoreCase("operation")) {
                return new AddSecurityCheckMethodAdapter(methodVisitor);
            }
            return methodVisitor;
        }

        return super.visitMethod(access, name, desc, signature, exceptions);


    }
}
